/**
 * Created by dean on 2016/12/19.
 */

// import * as myimportconstans from './const';
//
// console.log(myimportconstans.A);
// import涉及到js的模块化，与es6语法无法。比较难搞。这里先不管


var ddd = 7891;
console.log(window.ddd);

function test() {
    fff = 890;
    var eee = 908;
    console.log(eee);
}
test();
console.log(fff);
console.log(window.fff);
// console.log(eee);//eee is not defined
console.log(window.eee);

c = 555;

console.log(c);

console.log(window.c);

const a = [];
a.abb = {ccc:456};
Object.freeze(a);
console.log(constantize);
console.log(a);
a.abb.ccc = 678;
console.log(a);

var constantize = (obj) => {
    Object.freeze(obj);
    Object.keys(obj).forEach( (key,value) => {
        if(typeof obj[key] === 'object'){
            constantize(obj[key]);
        }
    });
};
console.log(constantize);
constantize(a);

a.abb.ccc = 890;
console.log(a);
